*This file compiles case-level data on FLSA criminal prosecutions into the data needed for Table 2, and in-text Statistics

import excel "$data/USC29CaseInfo - v20230130", firstrow clear

*Replace 0 probation sentence and fine numbers with missing so we can calculate mean sentence / fine IF sentenced / fined
replace ProbationSentenceMeanMonths = . if ProbationSentenceMeanMonths == 0 
replace FineMean = . if FineMean == 0 

collapse (sum) Numberofdefendedntsincasesc DefendantOutcomeConvictedby  H  DefendantOutcomeConvictedp J SentenceFineonly SentenceProbationnoprison SentencePrisonnoprobation SentencePrisonandprobation SentenceNosentence (mean) ProbationSentenceMeanMonths FineMean, by(USC29Section)

drop if missing(USC29)

gen NumberConvicted = DefendantOutcomeConvictedby + H + DefendantOutcomeConvictedp + J 
gen SentencePrison = SentencePrisonnoprobation + SentencePrisonandprobation
drop Numberofdefendedntsincasesc DefendantOutcomeConvictedby  H  DefendantOutcomeConvictedp J 
drop  SentencePrisonnoprobation SentencePrisonandprobation
order USC29 NumberConvicted SentenceFine FineMean SentenceProbationnoprison ProbationSentenceMean SentencePrison
drop SentenceNosentence
//*This generates Table 2 in the paper

collapse (sum) NumberConvicted SentenceFine SentenceProbationnoprison SentencePrison
//*This generates the statistics for totals over 1994-2020 (38 total convictions, 4 fines, 30 probation sentences, 0 prison sentences)



*2005 onward only
import excel "$data/USC29CaseInfo - v20230130", firstrow clear
keep if Year>=2005
*Replace 0 probation sentence and fine numbers with missing so we can calculate mean sentence / fine IF sentenced / fined
replace ProbationSentenceMeanMonths = . if ProbationSentenceMeanMonths == 0 
replace FineMean = . if FineMean == 0 

collapse (sum) Numberofdefendedntsincasesc DefendantOutcomeConvictedby  H  DefendantOutcomeConvictedp J SentenceFineonly SentenceProbationnoprison SentencePrisonnoprobation SentencePrisonandprobation SentenceNosentence 

gen NumberConvicted = DefendantOutcomeConvictedby + H + DefendantOutcomeConvictedp + J 
gen SentencePrison = SentencePrisonnoprobation + SentencePrisonandprobation
drop Numberofdefendedntsincasesc DefendantOutcomeConvictedby  H  DefendantOutcomeConvictedp J 
drop  SentencePrisonnoprobation SentencePrisonandprobation
order NumberConvicted SentenceFine SentenceProbationnoprison  SentencePrison
drop SentenceNosentence 
//*This generates total convictions and total fines, probation, and prison sentences for 2005-2020 to create the statistic in the text comparing with DOL Willful violations